package com.woniu.dao;

import com.woniu.dto.ActivityDTO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.Date;
import java.util.List;

public interface ActivityMapper {

    @Select("select ca.id,ca.ca_type type,ca.ca_examinetime operationTime,ca.ca_title title,ca.ca_content content,ca.ca_money money,ca.ca_peopel_count number,ca.ca_create_time createTime,ca.ca_examine_status status,pu.nickname name from " +
            "person_user pu inner join community_activity ca on pu.id=ca.ca_user_id order by ca.id desc")
    List<ActivityDTO> findByPage(@Param("currentPage") Integer currentPage, @Param("pageSize") Integer pageSize);

    @Update("update community_activity set ca_examine_status = 1,ca_examinetime = #{examineTime} where id=#{id}")
    void editStatusById(@Param("id") Integer id,@Param("examineTime") Date examineTime);

    List<ActivityDTO> select(@Param("name") String name, @Param("status") Integer status);

    @Update("update community_activity set ca_examine_status = 2,ca_examinetime = #{operationTime} where id=#{id}")
    void refuse(@Param("id") Integer id, @Param("operationTime") Date examineTime);
}
